package errcode

var MsgFlags = map[int]string{
	SUCCESS:           "success",
	ERROR:             "fail",
	RouteNotFound:     "route not found",
	InvalidParams:     "invalid params",
	SystemError:       "system error",
	ToManyRequest:     "to many request",
	TokenCreateFailed: "token创建失败",
	TokenEmptyHeader:  "请求头中auth无效",
	TokenInvalid:      "无效的Token",
	UserExist:         "用户名已存在",
	UserCreatedFailed: "用户创建失败",
	UserLoginFailed:   "用户登录失败",
	LoginForbidden:    "用户禁止登录",

	SHORTEN_GEN_FAIL: "短地址生成失败",
	SHORTEN_GET_FAIL: "获取短地址失败",
}

// GetMsg 通过错误码获取错误信息
func GetMsg(code int) string {
	msg, ok := MsgFlags[code]
	if ok {
		return msg
	}
	return MsgFlags[SystemError]
}
